Sys.Application.add_init(pageInit);

function pageInit() {
    //debugger;
    WriteDebug("Page Init Started");
    var prm = Sys.WebForms.PageRequestManager.getInstance()
    prm.add_initializeRequest(InitializeRequest);
    prm.add_beginRequest(BeginRequest);
    prm.add_pageLoading(PageLoading);
    prm.add_pageLoaded(PageLoaded);
    prm.add_endRequest(EndRequest);
    WriteDebug("Page Init Completed");
}

function InitializeRequest(sender, initializeRequestEventArgs) {
    WriteDebug('Update Panel Initialize Request');
}

function BeginRequest(sender, beginRequestEventArgs) {
    WriteDebug('Begin Update Panel Request');
}

function PageLoading(sender, pageLoadingEventArgs) {
    WriteDebug('Update Panel Loading');
}

function PageLoaded(sender, pageLoadedEventArgs) {
    WriteDebug('Update Panel Loaded');
    WriteDebug(pageLoadedEventArgs._panelsUpdated[0]);
}

function EndRequest(sender, endRequestEventArgs) {
    WriteDebug('End Update Panel Request');
}

function WriteDebug(value) {
    //try the web dev Debuger
    //window.debugService.trace(value);
    
    if(typeof(value) == 'object')
        Sys.Debug.traceDump(value, "Object");
    else
        Sys.Debug.trace(value);
}









